/**
 * fetchEnhancer
 */
define('utils/fetchEnhancer', ['utils/XFetch'], function(XFetch) {

var fetch = function(url, options) {
    if(undefined === options) {
        options = {};
    }
    
    if(undefined === options.method) {
        options.method = 'GET';
    }
    
    if(undefined === options.headers) {
        options.headers = {};
    }
    
    var headers = {
        'Content-Type': 'application/x-www-form-urlencoded'
    };
    
    for(var h in headers) {
        if(undefined === options.headers[h]) {
            options.headers[h] = headers[h];
        }
    }
    
    return new XFetch().fetch(url, options).then(function(res) {
        return res.json();
    });
};

return fetch;

});
